//
//  TestActorDownloadTests.swift
//  TestActorDownloadTests
//
//  Created by rolodestar on 2025/6/13.
//

import Testing
import SwiftData
import Foundation
@testable import TestActorDownload
struct TestActorDownloadTests {

    @Test func example() async throws {
        // Write your test here and use APIs like `#expect(...)` to check expected conditions.
        var sharedModelContainer: ModelContainer = {
            let schema = Schema([
                Item.self,
                DownloadDataModel.self,
            ])
            let modelConfiguration = ModelConfiguration(schema: schema, isStoredInMemoryOnly: false)

            do {
                return try ModelContainer(for: schema, configurations: [modelConfiguration])
            } catch {
                fatalError("Could not create ModelContainer: \(error)")
            }
        }()
        let shared = await DownloadManagerActor.createShared(modelContext: sharedModelContainer.mainContext)
        let url = URL(string: "https://alimov2.a.kwimgs.com/upic/2023/03/30/21/BMjAyMzAzMzAyMTQ5NTZfOTQ0MjI3OThfOTkzNzc4OTA3NzZfMV8z_b_B636d5cd22a8d53502669cb018bc9ffff.mp4?clientCacheKey=3xejy4ph2dq6niu_b.mp4&tt=b&di=78e498d6&bp=13414")!
//        let url = URL(string: "https://upos-sz-mirrorcos.bilivideo.com/upgcxcode/65/68/207226865/207226865-1-208.mp4?e=ig8euxZM2rNcNbhj7WdVhwdlhzTBhwdVhoNvNC8BqJIzNbfq9rVEuxTEnE8L5F6VnEsSTx0vkX8fqJeYTj_lta53NCM=&uipk=5&nbs=1&deadline=1749726354&gen=playurlv2&os=bcache&oi=2032490763&trid=00005a4c5c5929014d6a8eb8ee24008561f3T&mid=3493287610551129&platform=html5&og=hw&upsig=34f4edcb302d05cb0d4a3d5dfcff590f&uparams=e,uipk,nbs,deadline,gen,os,oi,trid,mid,platform,og&cdnid=87203&bvc=vod&nettype=0&bw=366977&orderid=0,1&buvid=&build=0&mobi_app=&f=T_0_0&logo=80000000")!
        try await shared.addDownloadTask(url: url)
    
    }

}
